/* GUI CONVERTED from removea.p (converter v1.75) Sat Aug 12 23:06:18 2000 */
/* removea.p  - REPETITIVE   MOVE NEXT OPERATION REGISTER MOVE SUBPROGRAM     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                         */
/*J2DG*/ /*V8:RunMode=Character,Windows */
/* REVISION: 7.3      LAST MODIFIED: 10/31/94   BY: WUG *GN77*                */
/* REVISION: 8.5      LAST MODIFIED: 05/12/95   BY: pma *J04T*                */
/* REVISION: 8.5      LAST MODIFIED: 05/15/96   BY: *G1VQ* Julie Milligan     */
/* REVISION: 9.0      LAST MODIFIED: 04/16/99   BY: *J2DG* Reetu Kapoor       */
/* REVISION: 9.1      LAST MODIFIED: 11/17/99   BY: *N04H* Vivek Gogte        */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb                */


/*J2DG*/ /* GROUPED MULTIPLE FIELD ASSIGNMENTS INTO ONE AND ADDED NO-UNDO */
/*J2DG*/ /* WHEREVER MISSING AND REPLACED FIND STATEMENTS WITH FOR FIRST  */
/*J2DG*/ /* STATEMENTS FOR ORACLE PERFORMANCE.                            */

         {mfdeclre.i}

         define input parameter cumwo_lot as character no-undo.
         define input parameter op        as integer   no-undo.
         define input parameter eff_date  as date      no-undo.
         define input parameter ophist_recid as recid  no-undo.
         define input parameter qty_move  as decimal   no-undo.

/*N04H** {rewrsdef.i}                                                         */

/*J04T   define variable glx_mthd like cs_method.        */
/*J04T   define variable glx_set like cs_set.            */
/*J04T   define variable cur_mthd like cs_method.        */
/*J04T   define variable cur_set like cs_set.            */
         define variable wip_qty     as decimal no-undo.
         define variable new_wip_qty as decimal no-undo.
         define variable outque_lbr_wip_value_move as decimal no-undo.
         define variable outque_bdn_wip_value_move as decimal no-undo.
         define variable outque_sub_wip_value_move as decimal no-undo.
         define variable outque_mtl_wip_value_move as decimal no-undo.

         if qty_move = 0 then leave.

         /*NO TRANSACTION SHOULD BE PENDING HERE*/
/*G1VQ*         {gprun.i ""gpistran.p"" "(input 1, input """")} */

/*J2DG** find wo_mstr where wo_lot = cumwo_lot no-lock. */
/*J2DG*/ for first wo_mstr
/*J2DG*/    fields (wo_lot)
/*J2DG*/    where wo_lot = cumwo_lot no-lock:
/*J2DG*/ end. /* FOR FIRST WO_MSTR */

/*J04T   find first wr_route where wr_lot = cumwo_lot and wr_op > op         */
/*J04T   no-lock no-error.                                                   */
/*J04T   /*DETERMINE COSTING METHOD*/                                        */
/*J04T   {gprun.i ""csavg01.p"" "(input wo_part, input wo_site,              */
/*J04T   output glx_set, output glx_mthd, output cur_set, output cur_mthd)" }*/
/*J04T   if available wr_route then do transaction:                          */

/*J04T*/ do transaction:
/*GUI*/ if global-beam-me-up then undo, leave.

            /*UPDATE QUEUES AND ACCUMS - FROM OP*/
            find wr_route where wr_lot = cumwo_lot and wr_op = op exclusive-lock.

/*N04H**    {rewrsget.i &lot=wr_lot &op=wr_op}                                */

/*J2DG*/    assign
               wr_qty_cummove = wr_qty_cummove + qty_move
               wr_qty_outque  = wr_qty_outque - qty_move.

/*N04H**    {rewrsput.i &lot=wr_lot &op=wr_op}                                */

            /*UPDATE QUEUES AND ACCUMS - TO OP*/
            find first wr_route where wr_lot = cumwo_lot and wr_op > op
            exclusive-lock no-error.

/*J04T*/    if not available wr_route then do:
/*J04T*/       {mfmsg.i 850 4} /*NOT CORRECT ENTRY*/
/*J04T*/       undo, return.
/*J04T*/    end.

/*N04H**    {rewrsget.i &lot=wr_lot &op=wr_op &lock=exclusive-lock}           */

            wr_qty_inque = wr_qty_inque + qty_move.

/*N04H**    {rewrsput.i &lot=wr_lot &op=wr_op}                                */

            /*UPDATE OP_HIST*/
            find op_hist where recid(op_hist) = ophist_recid exclusive-lock.
            op_qty_wip = qty_move.
         end.
/*GUI*/ if global-beam-me-up then undo, leave.


/*J04T*/ /*******INCORPORATED INTO CALLING PROGRAM WHERE REQUIRED*********
 *       else do:
 *         /*RECEIVE COMPLETED MATERIAL.                          */
 *         /*THIS SUBPROGRAM PICKS UP INPUT FROM SR_WKFL          */
 *          {gprun.i ""receive.p"" "(input cumwo_lot, input eff_date,
 *          input ophist_recid)"}
 *       end.
**J04T*/ /*******INCORPORATED INTO CALLING PROGRAM WHERE REQUIRED********/
